#pragma once
#include "psinterface.h"
#include <inttypes.h>

typedef IPSClient* (*FnCreateClient)(int, IPSMonitor*);

class CPSServer : public IPSServer
{
public:
	CPSServer(IPSMonitor* pMonitor, FnCreateClient fn);
	virtual ~CPSServer();

private:
	int					m_sock;
	IPSMonitor*			m_monitor;
	FnCreateClient		m_fnCreateClient;

public:
	virtual int		GetEventFd();
	virtual void	OnEventIn();
	virtual void	OnEventOut();
	virtual void	OnEventPri();
	virtual void	OnEventError();

public:
	virtual bool		FindClient(unsigned int id, IPSClientContext** pContext);

public:
	bool				Start(uint16_t port, uint32_t ip);
};


